package Exception;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Practice {
    public static void main(String[] args) throws IOException {
        Student zs=new Student();
        try {
            zs.setAge(200);
            System.out.println("age" + zs.getAge());
        }catch (Exception e){
            System.out.println("error");
        }



       /* System.out.println("start");
        try (
                FileOutputStream fos=new FileOutputStream("fos.dat");
        ) {

            fos.write(1);
        }catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("end");


        */

      /*  FileOutputStream fos=null;
        try {
            fos=new FileOutputStream("a/b/foss.dat");

        }catch (IOException e){
            System.out.println("IO");
        }finally {
            try {
                fos.close();
            } catch (Exception e) {
                System.out.println("finish");            }
        }



       */


       /* System.out.println("start");
        try {
            String line="null";
            System.out.println(line.length());
            return;
        }catch (Exception e){
            System.out.println("null");
        }finally {
            System.out.println("finally");
        }
        System.out.println("end");



        */


        /*try {
            String line1=null;
            System.out.println(line1.length());
            String line2="";
            System.out.println(line2.charAt(0));
            String line="abc";
            System.out.println(Integer.parseInt(line));

        }catch (NullPointerException e){
            System.out.println("null");
        }catch (StringIndexOutOfBoundsException e){
            System.out.println("String");
        }catch (Exception e){
            System.out.println("finally");
        }
        System.out.println("end");


         */



     /*   FileInputStream fis=new FileInputStream("pw.txt");
        InputStreamReader isr=new InputStreamReader(fis, StandardCharsets.UTF_8);
        BufferedReader br=new BufferedReader(isr);

        String line;
        while ((line=br.readLine())!=null){
            System.out.println(line);
            System.out.print(line);
        }
        br.close();


      */

       /* FileOutputStream fos=new FileOutputStream("pw2.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw=new BufferedWriter(osw);
        PrintWriter pw=new PrintWriter(bw);
        Scanner scan=new Scanner(System.in);
        while (true){
            String line=scan.nextLine();
            if ("exit".equals(line)){
                break;
            }
            pw.println(line);

        }
            pw.close();

        */
    }
}
